package main;

import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;

public class Messenger {
	PrintWriter writer;
	public Messenger(Socket s) throws IOException{
		writer = new PrintWriter(s.getOutputStream(), true);
	}
		public void moveElevatorUp(int number){
		String commandString = "m " + number + " 1";
		writer.println(commandString);
	}
	
	public void moveElevatorDown(int number){
		String commandString = "m " + number + " -1";
		writer.println(commandString);
	}
	
	public void openDoor(int number){
		String commandString = "d " + number + " 1";
		writer.println(commandString);
	}
	
	public void closeDoor(int number){
		String commandString = "d " + number + " -1";
		writer.println(commandString);
	}
	
	public void setScale(int elevatorNumber, int floorNumber){
		String commandString = "s " + elevatorNumber + " " + floorNumber;
		writer.println(commandString);
	}
	
	public void requestPosition(int elevatorNumber){
		String commandString = "w " + elevatorNumber;
		writer.println(commandString);
	}
	
	public void requestVelocity(){
		String commandString = "v";
		writer.println(commandString);
	}
}
